drop table jms_dwd.dwd_tab_missrate_waybill_detail;--循环袋建包明细
create table jms_dwd.dwd_tab_missrate_waybill_detail
(
    site_code            varchar(50) comment '转运中心编码',
    proxy_area_code      varchar(50) comment '代理区编码',
    billcode             varchar(100) comment '运单号',
    site_name            varchar(100) comment '转运中心名称',
    proxy_area_name      varchar(100) comment '代理区编码名称',
    scantime             varchar(100) comment '发件扫描时间',
    next_site            varchar(100) comment '发件下一站',
    scanuser             varchar(100) comment '发件扫描员',
    first_code           varchar(100) comment '一段码',
    second_code          varchar(100) comment '二段码',
    secondcode_site_code varchar(50) comment '运单二段码对应网点code',
    secondcode_site_name varchar(100) comment '运单二段码对应网点名称',
    distribution_code    varchar(50) comment '可派货集散点-时效-code',
    distribution_name    varchar(100) comment '可派货集散点-时效-名称',
    out_enport_code      varchar(50) comment '可派货集散点-二段码-code',
    out_enport_name      varchar(100) comment '可派货集散点-二段码-名称',
    sign_network_code    varchar(50) comment '时效签收网点code',
    sign_network_name    varchar(100) comment '时效签收网点名称',
    errorseparate_type   bigint comment '时效签收网点对应的操作错分类型1是三段码不全错分,2是三段码错误错分,3是操作错分',
    is_sign              bigint comment '是否已时效签收,1是0否',
    is_same_line1        bigint comment '是否在同一支线,时效,,1是0否',
    is_same_line2        bigint comment '是否在同一支线,二段码,,1是0否',
    day_time             date comment '日期'
) engine = olap duplicate key(site_code, proxy_area_code,billcode)
    comment "操作错分明细"
partition by range(day_time)
(start ("2022-06-01") end ("2022-07-08") every (interval 1 day)
)
distributed by hash(`billcode`) buckets 10
properties (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "day",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-180",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "10",
"in_memory" = "false",
"storage_format" = "v2"
);

